/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trefliq.EJB.webservice;

import java.util.List;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import trefliq.EJB.entities.Cart;
import trefliq.EJB.entities.Customers;
import trefliq.EJB.entities.Movie;
import trefliq.EJB.sessionbeans.CustomersSession;

/**
 *
 * @author Brandon
 */
//@WebService(serviceName = "CustomersWebService")
@Stateless()
public class CustomersWebService {
    @EJB
    private CustomersSession ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Web Service Operation")

    @WebMethod(operationName = "createCustomer")
    public Customers createCustomer(@WebParam(name = "e") Customers e) {
        return ejbRef.createCustomer(e);
    }

    @WebMethod(operationName = "deleteCustomer")
    public Customers deleteCustomer(@WebParam(name = "c") Customers c) {
        return ejbRef.deleteCustomer(c);
    }

    @WebMethod(operationName = "getAllCustomers")
    public List<Customers> getAllCustomers() {
        return ejbRef.getAllCustomers();
    }

    @WebMethod(operationName = "getCustomerById")
    public Customers getCustomerById(@WebParam(name = "customerId") Long customerId) {
        return ejbRef.getCustomerById(customerId);
    }

    @WebMethod(operationName = "getCustomerByPersonId")
    public Customers getCustomerByPersonId(@WebParam(name = "personId") Long personId) {
        return ejbRef.getCustomerByPersonId(personId);
    }
    
    @WebMethod(operationName = "addCart")
    @Oneway
    public void addCart(@WebParam(name = "customerId") Long customerId) {
        ejbRef.addCart(customerId);
    }

    @WebMethod(operationName = "deleteCart")
    @Oneway
    public void deleteCart(@WebParam(name = "customerId") Long customerId, @WebParam(name = "cartId") Cart cartId) {
        ejbRef.deleteCart(customerId, cartId);
    }

    @WebMethod(operationName = "addMovie")
    @Oneway
    public void addMovie(@WebParam(name = "customerId") Long customerId, @WebParam(name = "cartId") Cart cartId, @WebParam(name = "movie") Movie movie) {
        ejbRef.addMovie(customerId, cartId, movie);
    }

    @WebMethod(operationName = "deleteMovie")
    @Oneway
    public void deleteMovie(@WebParam(name = "customerId") Long customerId, @WebParam(name = "cartId") Cart cartId, @WebParam(name = "movie") Movie movie) {
        ejbRef.deleteMovie(customerId, cartId, movie);
    }
    
}
